// console.log(1);
// console.log(2);
// console.log(3);

for (let i = 0; i < 10; i++) {
  console.log(i);
}

for (let i = 0; i < 10; i++) {
  console.log(i);
}

let fruits = ["banana", "apple", "orange"];

for (let i = 0; i < fruits.length; i++) {
  let c = fruits[i] + "D";
  console.log(c);
}

for (let i = 0; i < 10; i++) {
  for (let j = 0; j < 5; j++) {
    console.log(j + " ----");
  }
  console.log(i);
}
//
// 1*1=1
// 2*1=1 2*2=2
// 3*1=1 3*2=6 3*3=9
// .....

// 写好一行 就能套上for循环 写好多行

// 写好一块 就能套上for循环 写好一行

// 3*2=6
for (let m = 1; m <= 9; m++) {
  let line = "";
  // let a = m;
  for (let i = 1; i <= m; i++) {
    // let b=i;
    let unit = m + "*" + i + "=" + m * i + " ";
    // console.log(unit);
    line = line + unit;
  }
  console.log(line);
}

for (let i = 0; i < 20; i++) {
  let target = 2;

  if (target > 4) {
    console.log("额外执行xxx");
  }
  if (target > 5) {
    console.log("大于5");
  } else {
    console.log(i + "<=5");
  }
}
//  continue break

for (let i = 0; i < 10; i++) {
  console.log("before1" + i);
  console.log("before2" + i);
  if (i === 5) {
    break;
  }
  console.log("after1" + i);
  console.log("after2" + i);
}
let tt = 1;
while (true) {
  if (tt > 5) {
    break;
  }
  tt++;
  console.log(tt);
}
//  while for
let ss = ["apple", "orange", "banana"];

for (let i = 0; i < ss.length; i++) {
  console.log(ss[i]);
//   ss.push("aaa");
}

// let num = 0;
// while(num < ss.length){
//     console.log(ss[num]);
//     num++;
// }